package com.zensun.web.controller.system;

import com.zensun.common.core.domain.R;
import com.zensun.system.domain.SysArea;
import com.zensun.system.service.ISysAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 省市县控制层
 *
 * @author gmk
 */
@Api(value = "省市区管理", tags = "省市区管理模块")
@RestController
@RequestMapping("/system/area")
public class SysAreaController {
    @Autowired
    private ISysAreaService areaService;


    /**
     * 获取省市县下拉树列表
     */
    @ApiOperation("获取省市县下拉树列表")
    @GetMapping("/treeselect")
    public R treeselect() {
        List<SysArea> areas = areaService.selectAreaList();
        return R.success(areaService.buildAreaTreeSelect(areas));
    }
}
